package testgaher;

import java.util.ArrayList;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86184
 * Date: 2023-09-26
 * Time: 11:58
 */
public class TestArrayList4 {
    public static void main(String[] args) {
        ArrayList<Double> score = new ArrayList<>();
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入输入成绩个数:> ");
        int n = sc.nextInt();
        for(int i = 0; i < n; i++){
            System.out.println("请输入成绩:> ");
            double d = sc.nextDouble();
            score.add(d);
        }
        //打印
        for(Double x : score){
            System.out.println(x);
        }

        //平均值
        double sum = 0;
        for(Double x : score){
            sum += x;
        }
        System.out.println("agv = "+sum / score.size());

        //<60
        int c = 0;
        for(Double x : score){
            if(x < 60)
                c++;
        }
        System.out.println(c);

        //max
        double max = score.get(0);
        for(Double x : score){
            if(max < x) {
                max = x;
            }
        }
        System.out.println(max);
    }
}
